#include <cstdio>

int main() {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);

    int start = a * 60 + b;
    int end = c * 60 + d;

    int spend_time = end - start;
    if (spend_time <= 0) {
        spend_time += 1440;
    }
    printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", spend_time / 60, spend_time % 60);

    return 0;
}
